<html>
<head><meta charset="utf-8"><title>Cron Job Failure 2021-07-15 · miri · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/index.html">miri</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html">Cron Job Failure 2021-07-15</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246056351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246056351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> miri-test-libstd <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246056351">(Jul 15 2021 at 06:27)</a>:</h4>
<p>Dear <span class="user-mention" data-user-id="120791">@RalfJ</span>,</p>
<p>The standard library test suite is failing under Miri. Would you mind investigating this issue?</p>
<p>Thanks in advance!<br>
Sincerely,<br>
The Miri Cronjobs Bot</p>



<a name="246058902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246058902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246058902">(Jul 15 2021 at 07:10)</a>:</h4>
<p>That is strange, just one of the doctests is failing with a compiler error?<br>
<a href="https://github.com/rust-lang/miri-test-libstd/runs/3073718536?check_suite_focus=true">https://github.com/rust-lang/miri-test-libstd/runs/3073718536?check_suite_focus=true</a></p>



<a name="246059171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246059171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246059171">(Jul 15 2021 at 07:13)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/86211">https://github.com/rust-lang/rust/pull/86211</a> landed recently changing all that code, so it does not seem random</p>



<a name="246059440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246059440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246059440">(Jul 15 2021 at 07:17)</a>:</h4>
<p><span class="user-mention" data-user-id="374396">@hyd-dev</span> any idea why out of all the tests, just this one fails?</p>
<div class="codehilite"><pre><span></span><code>test ../libcore/src/option.rs - option (line 22) ... ok
test ../libcore/src/option.rs - option (line 261) ... ok
test ../libcore/src/option.rs - option (line 317) ... ok
test ../libcore/src/option.rs - option (line 350) - compile fail ... FAILED
test ../libcore/src/option.rs - option (line 331) ... ok
test ../libcore/src/option.rs - option (line 372) ... ok
test ../libcore/src/option.rs - option (line 389) ... ok
test ../libcore/src/option.rs - option (line 433) ... ok
test ../libcore/src/option.rs - option (line 447) ... ok
test ../libcore/src/option.rs - option (line 57) ... ok
</code></pre></div>



<a name="246061258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246061258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246061258">(Jul 15 2021 at 07:41)</a>:</h4>
<p>I can reproduce the problem locally, it's not just some weird flake of the CI environment</p>



<a name="246061359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246061359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246061359">(Jul 15 2021 at 07:42)</a>:</h4>
<p>There are other compile_fail tests in libcore that work fine</p>



<a name="246061372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246061372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246061372">(Jul 15 2021 at 07:42)</a>:</h4>
<p>but those are more self-contained</p>



<a name="246061420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246061420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246061420">(Jul 15 2021 at 07:43)</a>:</h4>
<p>looks almost as if it's missing the prelude or something like that?</p>
<div class="codehilite"><pre><span></span><code> 80 | pub struct Range&lt;Idx&gt; {
   | --------------------- doesn&#39;t satisfy `_: std::iter::Iterator`
   |
   = note: the following trait bounds were not satisfied:
           `core_miri_test::ops::Range&lt;{integer}&gt;: std::iter::Iterator`
           which is required by `&amp;mut core_miri_test::ops::Range&lt;{integer}&gt;: std::iter::Iterator`
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
3  | use core_miri_test::iter::Iterator;
</code></pre></div>



<a name="246061489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246061489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246061489">(Jul 15 2021 at 07:44)</a>:</h4>
<p>but then we have tons of</p>
<div class="codehilite"><pre><span></span><code>error: duplicate lang item in crate `core_miri_test`: `RangeTo`.
</code></pre></div>
<p>so that's more like it is importing the prelude twice</p>



<a name="246061517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246061517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246061517">(Jul 15 2021 at 07:44)</a>:</h4>
<p>my guess would be that this</p>
<div class="codehilite"><pre><span></span><code>use std::iter::{empty, once};
</code></pre></div>
<p>somehow goes wrong, maybe a wrong sysroot or dylib-path or so</p>



<a name="246145990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246145990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246145990">(Jul 15 2021 at 19:48)</a>:</h4>
<p>It looks like it loads both <code>core</code> from sysroot and <code>core_miri_test</code>, but I guess it should only load the former?</p>



<a name="246146097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246146097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246146097">(Jul 15 2021 at 19:49)</a>:</h4>
<blockquote>
<p>use std::iter::{empty, once};</p>
</blockquote>
<p>But this compiles successfully <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">//! ```compile_fail,E0308</span>
<span class="sd">//! #![allow(warnings)]</span>
<span class="sd">//! # use std::iter::{empty, once};</span>
<span class="sd">//! ```</span>
</code></pre></div>



<a name="246189390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246189390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246189390">(Jul 16 2021 at 06:38)</a>:</h4>
<p>It seems that it's caused by  <code>match x</code>. Changing it to <code>match do_insert</code> works.</p>



<a name="246190583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246190583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246190583">(Jul 16 2021 at 06:59)</a>:</h4>
<p>I think there are two libcore there: <code>core</code> in sysroot and <code>core_miri_test</code>. Cargo/rustdoc passes <code>--extern core_miri_test=...</code> to Miri in this test (and probably in other tests as well, I haven't confirmed that because I don't know a convenient way to see command-line arguments for passed tests). I guess although <code>--extern core_miri_test=...</code> is present, it's not actually loaded by Miri in other tests and it's not supposed to be loaded in this test either, but the unknown identifier <code>x</code> somehow makes Miri load it.</p>



<a name="246191559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246191559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246191559">(Jul 16 2021 at 07:11)</a>:</h4>
<p>Properly fixing this seems to require eliding one libcore, but I'm not sure how.</p>



<a name="246194755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246194755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246194755">(Jul 16 2021 at 07:56)</a>:</h4>
<p>I haven't find a way to stop Cargo/rustdoc from passing <code>--extern core_miri_test=...</code> or not use <code>core</code> from sysroot without hack (at least not yet), but this seems to work:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/core_miri_test/Cargo.toml b/core_miri_test/Cargo.toml</span>
<span class="gh">index 524cce8..b8df702 100644</span>
<span class="gd">--- a/core_miri_test/Cargo.toml</span>
<span class="gi">+++ b/core_miri_test/Cargo.toml</span>
<span class="gu">@@ -12,6 +12,10 @@ path = "../libcore/src/lib.rs"</span>
 test = false
 bench = false

<span class="gi">+[features]</span>
<span class="gi">+miri-test = []</span>
<span class="gi">+default = ["miri-test"]</span>
<span class="gi">+</span>
 [[test]]
 name = "coretests"
 path = "../libcore/tests/lib.rs"
<span class="gh">diff --git a/rust-src.diff b/rust-src.diff</span>
<span class="gh">index e69de29..965f559 100644</span>
<span class="gd">--- a/rust-src.diff</span>
<span class="gi">+++ b/rust-src.diff</span>
<span class="gu">@@ -0,0 +1,12 @@</span>
<span class="gi">+diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs</span>
<span class="gi">+index 3557dbad..6c089b0c 100644</span>
<span class="gi">+--- a/library/core/src/lib.rs</span>
<span class="gi">++++ b/library/core/src/lib.rs</span>
<span class="gi">+@@ -49,6 +49,7 @@</span>
<span class="gi">+ //</span>
<span class="gi">+ // This cfg won't affect doc tests.</span>
<span class="gi">+ #![cfg(not(test))]</span>
<span class="gi">++#![cfg(any(not(feature = "miri-test"), doctest))]</span>
<span class="gi">+ #![stable(feature = "core", since = "1.6.0")]</span>
<span class="gi">+ #![doc(</span>
<span class="gi">+     html_playground_url = "https://play.rust-lang.org/",</span>
</code></pre></div>



<a name="246197105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246197105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246197105">(Jul 16 2021 at 08:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="374396">hyd-dev</span> <a href="#narrow/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15/near/246146097">said</a>:</p>
<blockquote>
<blockquote>
<p>use std::iter::{empty, once};</p>
</blockquote>
<p>But this compiles successfully <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span>:</p>
<p><div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">//! ```compile_fail,E0308</span>
<span class="sd">//! #![allow(warnings)]</span>
<span class="sd">//! # use std::iter::{empty, once};</span>
<span class="sd">//! ```</span>
</code></pre></div><br>
</p>
</blockquote>
<p>even in core context?</p>
<p>when I add</p>
<div class="codehilite"><pre><span></span><code>use std::iter::{empty, once};
</code></pre></div>
<p>do another doctest in core, it likewise fails. OTOH, <code>use std::collections::BTreeMap;</code> works fine.</p>
<p>EDIT: ignore this, it ails with a totally different error.</p>



<a name="246197185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246197185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246197185">(Jul 16 2021 at 08:29)</a>:</h4>
<blockquote>
<p>but the unknown identifier x somehow makes Miri load it.</p>
</blockquote>
<p>ah, so maybe it is loaded by the code that makes suggestions for which things to import? I assume <code>x</code> here is a typo...</p>



<a name="246197214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246197214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246197214">(Jul 16 2021 at 08:29)</a>:</h4>
<p>okay, fixing that typo fixes the bug... good catch <span class="user-mention" data-user-id="374396">@hyd-dev</span> !</p>



<a name="246197305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246197305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246197305">(Jul 16 2021 at 08:30)</a>:</h4>
<p>There still is some problem with rustc not always using the right libcore, but at least we can run the test suite now</p>



<a name="246197340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246197340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246197340">(Jul 16 2021 at 08:31)</a>:</h4>
<blockquote>
<p>I think there are two libcore there: core in sysroot and core_miri_test</p>
</blockquote>
<p>yes but this is the case even when running these doctests without miri, and there it works.</p>



<a name="246197997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/Cron%20Job%20Failure%202021-07-15/near/246197997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/Cron.20Job.20Failure.202021-07-15.html#246197997">(Jul 16 2021 at 08:39)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/miri/issues/1852">https://github.com/rust-lang/miri/issues/1852</a> for that, and <a href="https://github.com/rust-lang/rust/pull/87183">https://github.com/rust-lang/rust/pull/87183</a> to get the doctests to work again for now</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>